package com.workplan.client.modules.events;

import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.workplan.client.modules.Modules;

public class SwitchModuleEvent extends GwtEvent<SwitchModuleEvent.Handler> {

	public static Type<Handler> TYPE = new Type<Handler>();
	private final Modules modules;

	public SwitchModuleEvent(Modules modules) {
		this.modules = modules;
	}

	public interface Handler extends EventHandler {
		void onSwitchModule(SwitchModuleEvent event);
	}

	@Override
	public Type<Handler> getAssociatedType() {
		return TYPE;
	}

	public Modules getNewModule() {
		return modules;
	}

	@Override
	protected void dispatch(Handler handler) {
		handler.onSwitchModule(this);
	}

}
